import pytest

from api.login_api import LoginApi
from utils.base_api import TestStep
from utils.logger import log


@pytest.fixture(scope="session", autouse=True)
def login(request):
    TestStep(
        LoginApi()
            .with_path_params({"in": "in"})
            .run()
            .assert_that()
            .status_code(200)
            .extract()
            .json_path("$..token", "token", is_global=True)
    )

    yield
    # teardown
	# 还原测试环境部分代码

    log.info("本轮测试已结束，正在还原测试环境！")